#version 300 es
#define WEBGL2 
#define OFFSET 1
#define SHADER_NAME fragment:depthBoxBlur
precision highp float;
in vec2 vUV;
uniform sampler2D textureSampler;
uniform vec2 screenSize;
#define CUSTOM_FRAGMENT_DEFINITIONS
layout(location = 0) out vec4 glFragColor;
void main(void)
{
vec4 colorDepth=vec4(0.0);
for (int x=-OFFSET;
x<=OFFSET;
x++)
for (int y=-OFFSET;
y<=OFFSET;
y++)
colorDepth+=texture(textureSampler,vUV+vec2(x,y)/screenSize);
glFragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));
}